#pragma once

#include "BufBlock.h"

class CBufChunkMgr;

class CBufBlockMgr
{
public:
    CBufBlockMgr(CBufChunkMgr *pChunks);
    ~CBufBlockMgr();
    void *operator new(size_t sz);
    void operator delete(void *ptr);
    void Destroy();

public:
    BufBlockNode *GetBlock();
    bool FreeBlock(BufBlockNode *pNode);

private:
    BufBlockNode *NewBlock();
    void DeleteBlock(BufBlockNode *pNode);

private:
    CBufBlockList m_lstFree;
    CBufChunkMgr *m_pChunks;
};
